package com.ibeetl.app.service;

import com.ibeetl.admin.core.service.BaseService;
import com.ibeetl.admin.core.util.DateUtil;
import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.app.dao.WechatAppDao;
import com.ibeetl.app.entity.ProcessResultDto;
import com.ibeetl.cms.dao.AnnualRevenueDao;
import com.ibeetl.cms.entity.AnnualRevenue;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 营销 Service
 */

@Service
@Transactional
public class WechatAppService extends BaseService<ProcessResultDto>{

    @Autowired
    private WechatAppDao wechatAppDao;

    public Map getProcessResult(String number,String year){
        Map<String,String> result = new HashMap<>();
        for(int i=1;i<10;i++){
            ProcessResultDto dto = wechatAppDao.getProcessResult(getTableName(i), number, year);
            if(dto==null || dto.getBusinessState()==null){
                continue;
//                result.put(getTableName(i), "暂无相关信息");
            }
            result.put(getName(i), dto.getBusinessState());
        }
        if(result.size()==0){
            return null;
        }
        return result;
    }

    private String getName(int i) {
        switch (i){
            case 1:return "产业人才";
            case 2:return "专业奖励";
            case 3:return "购房";
            case 4:return "技能奖励";
            case 5:return "专业技术补贴";
            case 6:return "租房补贴";
            case 7:return "博士后在站补贴";
            case 8:return "博士后出站补贴";
            case 9:return "高层次人才";
//            case 10:return "site_funds";
//            case 10:return "离职";
//            case 11:return "入职";
//            case 12:return "关键信息";
//            case 13:return "医疗管理";
//            case 14:return "保险";
            default:return "";
        }
    }

    public String getTableName(int i){
        switch (i){
            case 1:return "industrial_talents";
            case 2:return "preparatory_talent";
            case 3:return "buy_house_subsidies";
            case 4:return "skill";
            case 5:return "professional_technology";
            case 6:return "renting";
            case 7:return "doctoral_subsidy";
            case 8:return "outbound_subsidy";
            case 9:return "highlevel_talents";
//            case 10:return "site_funds";
//            case 10:return "quit";
//            case 11:return "entry";
//            case 12:return "key_information";
//            case 13:return "medical_care";
//            case 14:return "insurance";
            default:return "";
        }
    }
}